import api from '@/utils/api';

export function pageList(params) {
  return api({
    url: '/article/pageList',
    method: 'get',
    params: params
  })
}

export function detail(id) {
  return api({
    url: '/article/' + id,
    method: 'get',
  })
}

export function save(data) {
  if (data.id) {
    return api({
      url: '/article/' + data.id,
      method: 'put',
      data: data
    })
  } else {
    return api({
      url: '/article',
      method: 'post',
      data: data
    })
  }
}

export function del(id) {
  return api({
    url: '/article/' + id,
    method: 'delete',
  })
}
